{{#extends @html/widget/hp/widget.html}}

{{:widget_class}}wg-votes{{/:widget_class}}

{{:widget_body}}
	{{!connect "theme/widget/votes.css"}}
	{{?widget.tdi_not_found}}
		<div class="typography"><p>Виджет не настроен</p></div>
	{{?:}}
		{{:widget_title}}{{widget.content.name}}{{/:widget_title}}
		<div class="typography"><p class="desc-">{{widget.content.question}}</p></div>
		{{?widget.isVoted==0 && widget.content.can_vote}}
			{{!for widget.content.answers do=@:v_answ}}
			{{:v_answ}}
				<ul class="list-">
					<li class="item-"><input value="{{*num}}" name="vote_variant" id="{{widget.widget_id}}-{{*num}}" type="radio" class="radio-" /> <label for="{{widget.widget_id}}-{{*num}}" class="label-">{{*text}}</label></li>
				</ul>
			{{/:v_answ}}
			<input type="button" name="vote_button" value="Голосовать" onclick="onVote({{widget.widget_id}})" class="submit-" />
			{{?widget.content.can_close}}
			<input type="button" name="vote_button" value="Завершить" onclick="voteClose({{widget.widget_id}})" class="submit-" />
			{{/?}}
		{{?:}}
			<div class="typography"><p>Всего голосов — <strong>{{widget.content.overall_voters}}</strong>, из них:</p></div>
			<div class="alist-">
			{{!for widget.content.answers do=@:v_votes}}{{:v_votes}}
				<!--{{*num}}-->
				<div class="item-">
					<div class="vote-">{{*text}} — <strong>{{*votes}}</strong></div>
					<div class="percentage-">{{!eval (*votes * 100 / widget.content.max_voters) }}%</div>
					<div class="bar-"><div class="bggg1-"><div class="bggg2-" style="width: {{!eval (*votes * 100 / widget.content.max_voters) }}%;"><div class="bggg3-"></div></div></div></div>
				</div>
			{{/:v_votes}}
			{{?widget.content.can_close}}
			<input type="button" name="vote_button" value="Завершить" onclick="voteClose({{widget.widget_id}})" class="submit-" />
			{{/?}}
			{{?widget.content.can_open}}
			<input type="button" name="vote_button" value="Открыть" onclick="voteOpen({{widget.widget_id}})" class="submit-" />
			{{/?}}
			</div>
		{{/?}}
	{{/?}}
{{/:widget_body}}